package com.example.petshopping.network;

import com.example.petshopping.model.AppAuthLoginRespVO;
import com.example.petshopping.model.AppMemberUserInfoRespVO;
import com.example.petshopping.model.AppMemberUserUpdateReqVO;
import com.example.petshopping.model.AppPetSpecialPerformancePageReqVO;
import com.example.petshopping.model.CommonResult;
import com.example.petshopping.model.RefreshTokenRequest;
import com.example.petshopping.model.SmsCodeRequest;
import com.example.petshopping.model.SmsLoginRequest;
import com.example.petshopping.model.SocialLoginRequest;
import com.example.petshopping.model.AppPetAuctionItemPageReqVO;
import com.example.petshopping.model.AppPetAuctionItemRespVO;
import com.example.petshopping.model.PageResult;
import com.example.petshopping.model.AppProductSpuDetailRespVO;
import com.example.petshopping.model.AppPetSpecialPerformanceRespVO;
import com.example.petshopping.model.SpecialPerformanceTagVO;
import com.example.petshopping.model.AppPetAuctionBidRespVO;
import com.example.petshopping.model.AppPetAuctionBidSaveReqVO;
import com.example.petshopping.model.AppCartListResponseVO;

import java.util.List;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Query;

public interface ApiService {
    // 社交登录
    @POST("member/auth/social-login")
    Call<CommonResult<AppAuthLoginRespVO>> socialLogin(@Body SocialLoginRequest request);
    // 发送短信验证码
    @POST("member/auth/send-sms-code")
    Call<CommonResult<Boolean>> sendSmsCode(@Body SmsCodeRequest request);
    // 手机号+验证码登录
    @POST("member/auth/sms-login")
    Call<CommonResult<AppAuthLoginRespVO>> smsLogin(@Body SmsLoginRequest request, @Header("terminal") String terminal);
    // 刷新令牌
    @POST("member/auth/refresh-token")
    Call<CommonResult<AppAuthLoginRespVO>> refreshToken(@Body RefreshTokenRequest request);
    // 退出登录
    @POST("member/auth/logout")
    Call<CommonResult<Boolean>> logout();
    
    // 获取用户基本信息
    @GET("member/user/get")
    Call<CommonResult<AppMemberUserInfoRespVO>> getUserInfo();
    
    // 修改用户基本信息
    @PUT("member/user/update")
    Call<CommonResult<Boolean>> updateUserInfo(@Body AppMemberUserUpdateReqVO request);
    
    // 文件上传
    @Multipart
    @POST("infra/file/upload")
    Call<CommonResult<String>> uploadFile(@Part MultipartBody.Part file, @Part("directory") RequestBody directory);
    
    // 获取宠物拍卖商品分页
    @GET("product/pet-auction-item/page")
    Call<CommonResult<PageResult<AppPetAuctionItemRespVO>>> getPetAuctionItemPage(
        @Query("pageNo") Integer pageNo,
        @Query("pageSize") Integer pageSize,
        @Query("spuId") Long spuId,
        @Query("auctionType") Integer auctionType,
        @Query("startingPrice") Integer startingPrice,
        @Query("priceIncrement") Integer priceIncrement,
        @Query("status") Integer status,
        @Query("isPromoted") Boolean isPromoted,
        @Query("sellerId") Long sellerId,
        @Query("sellerName") String sellerName,
        @Query("spId") Integer spId
    );

    // 根据ID获取宠物拍卖商品详情
    @GET("product/pet-auction-item/get")
    Call<CommonResult<AppPetAuctionItemRespVO>> getPetAuctionItem(@Query("id") Long id);

    // 获取商品 SPU 明细（无需登录）
    @GET("product/spu/get-detail")
    Call<CommonResult<AppProductSpuDetailRespVO>> getProductSpuDetail(@Query("id") Long id);

    // 获取宠物专场分页
    @POST("product/pet-special-performance/page")
    Call<CommonResult<PageResult<AppPetSpecialPerformanceRespVO>>> getPetSpecialPerformancePage(@Body AppPetSpecialPerformancePageReqVO pageReqVO);

    // 获取宠物专场标签列表
    @GET("product/pet-special-performance/special-performance-tags")
    Call<CommonResult<List<SpecialPerformanceTagVO>>> getSpecialPerformanceTags();

    // 获取拍卖出价记录分页
    @GET("product/pet-auction-bid/page")
    Call<CommonResult<PageResult<AppPetAuctionBidRespVO>>> getPetAuctionBidPage(
        @Query("pageNo") Integer pageNo,
        @Query("pageSize") Integer pageSize,
        @Query("auctionItemId") Long auctionItemId,
        @Query("bidderId") Long bidderId,
        @Query("bidderName") String bidderName,
        @Query("bidPrice") Integer bidPrice,
        @Query("status") Integer status
    );

    // 创建拍卖出价记录
    @POST("product/pet-auction-bid/create")
    Call<CommonResult<AppPetAuctionBidRespVO>> createPetAuctionBid(@Body AppPetAuctionBidSaveReqVO reqVO);

    // 获取用户的待确认商品列表
    @GET("trade/cart/display/list")
    Call<CommonResult<AppCartListResponseVO>> getCartDisplayList();
} 